home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 1995 May / PC Answers CD-ROM 7 (Future Publishing) (May 1995).iso / mag / coderoom / form1.txt < prev    next >
Encoding:
Text File  |  1995-02-04  |  923 b   |  50 lines

  1. Sub ExitSaver ()
  2.     Unload Form1
  3. End Sub
  4.  
  5. Sub Form_Click ()
  6.     ExitSaver
  7. End Sub
  8.  
  9. Sub Form_Load ()
  10.  
  11.     ' See if we're already running
  12.  
  13.     If App.PrevInstance Then End
  14.  
  15.     ' Make picture invisible while we set it up
  16.  
  17.     Picture1.Visible = False
  18.  
  19.     ' Set path for file searches
  20.  
  21.     File1.Path = App.Path + "\PICS"
  22.  
  23.     ' Make sure we've got at least one file!
  24.  
  25.     If File1.ListCount <> 0 Then
  26.     Randomize
  27.     Choice = Int((File1.ListCount * Rnd) + 1) - 1
  28.     Path$ = File1.Path + "\" + File1.List(Choice)
  29.     Picture1.Picture = LoadPicture(Path$)
  30.  
  31.     ' Centre Picture1 on the screen
  32.  
  33.     Picture1.Left = (Screen.Width - Picture1.Width) / 2
  34.     Picture1.Top = (Screen.Height - Picture1.Height) / 2
  35.     
  36.     ' Now make it visible
  37.  
  38.     Picture1.Visible = True
  39.     End If
  40. End Sub
  41.  
  42. Sub Picture1_Click ()
  43.     ExitSaver
  44. End Sub
  45.  
  46. Sub Picture1_KeyPress (KeyAscii As Integer)
  47.     ExitSaver
  48. End Sub
  49.  
  50.